var argscheck = require('cordova/argscheck');
var amapLocation = {
    getCurrentPosition: function (successCallback, errorCallback, options) {
    	argscheck.checkArgs('fFO', 'MyAMapLocation.getCurrentPosition', arguments);
    	var enableHighAccuracy = argscheck.getValue(options.enableHighAccuracy, false);
    	var coorType = argscheck.getValue(options.coorType, 'gcj02');
    	var timeout = argscheck.getValue(options.timeout, 10000);
    	var scanSpan = argscheck.getValue(options.scanSpan, 0);
    	var isNeedAddress = argscheck.getValue(options.isNeedAddress, false);
    	
    	var args = [enableHighAccuracy,coorType,timeout,scanSpan,isNeedAddress];
        cordova.exec(function (pos) {
            successCallback(pos);
        }, function (err) {
        	errorCallback(err);
        }, 'MyAMapLocation', 'getCurrentPosition', args);
    },
    stop: function (action, successCallback, errorCallback) {
        cordova.exec(successCallback, errorCallback, 'MyAMapLocation', 'stop', []);
    }
}

module.exports = amapLocation;